.\" (C) Copyright Sridhar Samudrala IBM Corp. 2004, 2005.
.\"
.\" Permission is granted to distribute possibly modified copies
.\" of this manual provided the header is included verbatim,
.\" and in case of nontrivial modification author and date
.\" of the modification is added to the header.
.\"
.TH SCTP_GETPADDRS 3 2005-10-25 "Linux 2.6" "Linux Programmer's Manual"
.SH NAME
sctp_getpaddrs \- Returns all peer addresses in an association. 
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.B #include <sys/socket.h>
.B #include <netinet/sctp.h>
.sp
.BI "int sctp_getpaddrs(int " sd ", sctp_assoc_t " assoc_id ,
.BI "                   struct sockaddr **" addrs );
.sp
.BI "void sctp_freepaddrs(struct sockaddr *" addrs );
.fi
.SH DESCRIPTION
.BR sctp_getpaddrs
returns all peer addresses in an association. On return,
.I addrs
will point to a dynamically allocated packed array of
.B sockaddr
structures of the appropriate type for each address. The caller should use 
.BR sctp_freepaddrs
to free the memory. Note that the in/out parameter
.I addrs
must not be NULL.
.PP
If
.I sd
is an IPv4 socket, the addresses returned will be all IPv4 addresses. If
.I sd
is an IPv6 socket, the addresses returned can be a mix of IPv4 or IPv6
addresses.
.PP
For one-to-many style sockets,
.I id
specifies the association to query. For one-to-one style sockets,
.I id
is ignored.
.PP
.BR sctp_freepaddrs
frees all the resources allocated by
.BR sctp_getpaddrs. 
.SH "RETURN VALUE"
On success,
.BR sctp_getpaddrs
returns the number of peer addresses in the association. If there is no
association on this socket, 0 is returned and the value of 
.I *addrs
is undefined. On error,
.BR sctp_getpaddrs
returns -1 and the value of
.I *addrs
is undefined.
.SH "SEE ALSO"
.BR sctp (7)
.BR sctp_bindx (3),
.BR sctp_connectx (3),
.BR sctp_sendmsg (3),
.BR sctp_sendv (3),
.BR sctp_send (3),
.BR sctp_recvmsg (3),
.BR sctp_recvv (3),
.BR sctp_peeloff (3),
.BR sctp_getladdrs (3),
.BR sctp_opt_info (3),
